1. Field of the Invention
The present invention relates to a data compression method for an image to be searched, a pattern model positioning method in image processing, an image processing apparatus, an image processing program, and a computer readable recording medium upon searching out of the image to be searched and positioning a pattern model corresponding to a pre-registered image.
2. Description of the Related Art
An image processing apparatus for processing an image picked up by an image pickup element typically includes: an image pickup apparatus for picking up an image processing object (hereinafter also referred to as “work”); an image data storing device for storing data on the image picked up by the image pickup apparatus; and an image data processing device for processing the image data stored by the image data storing device. For example, in the image processing apparatus where the image pickup apparatus is made up of a CCD camera, luminance data (so-called multi-valued data) such as 256 levels of gray or 1024 levels of gray is obtained based on each of charge amounts of a large number of charge coupled elements constituting an image pickup surface, whereby a position, a rotational angle and the like of the work as an object to be searched can be found. Conventionally, as techniques for performing processing on image data to search an object to be searched in image processing, there are known a difference search performed using a total value of absolute values of pixel difference values between images, a normalized correlation search performed using normalized correlation values between images, and the like. In these searches, an object to be searched that is wished to be searched is previously registered as a template image, and based on the image, a search is executed for the object to be searched out of an image to be searched. In these search processing, a region-based search by use of image data has conventionally been mainstream. However, such a conventional region-based search based on image thickness or the like has the problem of being susceptible to a change in illumination upon image pickup, and the like.
Meanwhile, there has also been provided a method for performing edge extraction processing on a registered image and an image to be searched, to perform a search based on edge information. In this method, a concentration value of pixels constituting image data is not used, but edge data based on an amount of change in concentration value is used, and hence it is possible to obtain the advantage of being not susceptible to fluctuations in illumination upon image pickup. Especially, in recent years, an edge-based pattern search with an edge regarded as a characteristic amount is drawing attention for its high robustness, and is in practical use in industrial applications and the like.
As a technique for improving a processing speed of a pattern search, a “coarse to fine” approach is known. Namely, first, a search is coarsely performed using a low-resolution image (coarse image), and after a rough position is specified, detailed positioning is performed using a high-resolution image (fine image), thereby to enhance accuracy of a position and posture. As a technique concerning fine positioning for finding a position and posture with high accuracy by means of such coarse-to-fine type template matching, an image processing apparatus of Japanese Patent No. 3759983 is known.
In the case of performing the edge-based search by means of coarse-to-fine type template matching, a pyramid search is used where a search is performed using coarse data obtained by compressing (also referred to as “thinning out” or the like) original data, to specify a rough position, and thereafter, a search is performed using detailed data. FIG. 87 shows a concept of the pyramid search. As shown in this drawing, a rough search (referred to as “coarse search” or the like) is performed using a low-resolution image having a high reduction ratio, to find a rough position. Thereafter, a search is performed in the vicinity thereof with an increased resolution and an intermediate reduction ratio, and finally, a fine search is performed on an image of an original size or an image having a reduction ratio close to the original size. As thus described, in the typical pyramid search, a plurality of images having changed resolutions are prepared, and a schematic position is first detected by use of an image having the lowest resolution. In subsequent processing, a search range is narrowed down to the vicinity of the previous detected position as the resolution is gradually increased. Thereby, the accuracy of the detected position enhances with each succeeding processing level, finally leading to detection of a highly accurate position with the resolution being that of the original image or closer thereto.
However, upon performing such a pyramid search, when a compression ratio is increased with the aim of higher-speed processing, an amount of characteristics such as an edge strength and an edge angle in a pattern image as an object to be searched is reduced due to compression of image data, thus causing the problem of making the search difficult since matching is performed based on the reduced characteristics. Especially in the edge-based search, information on an angle of an edge is highly important as information for use in the search, and it is necessary to effectively keeps information on the edge angle. Meanwhile, reducing an image as in the pyramid search is inevitable for improvement in processing speed, and at this time, the edge angle information might be lost. Therefore, upon performing a first coarse search, setting a reduction ratio of a reduced image is extremely important. Namely, if the first search is performed on an extremely reduced image, the search is performed in a state where a characteristic amount necessary for the search has been lost, and hence the search itself might be failed. On the contrary, when the first search is performed on an image having a low reduction ratio, it takes long to perform the search. Accordingly, upon performing the first search, an appropriate reduction ratio needs to be set in accordance with the user's usage and objective. However, setting an optimal reduction ratio is not easy. When the user is too conscious of keeping enough a characteristic amount to prevent failure of the search, a situation may occur where a search has to be performed on data on a characteristic amount extracted with a reduction ratio as low as the order of one-half depending upon a pattern image, thereby bringing about a state where the processing speed cannot be regarded as sufficient. As thus described, the search accuracy and the processing speed are in the trade-off relation, and hence making both compatible has been extremely difficult.